﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


class Program
{
    static int[] MyArray;
    static int n;
    static int k;

    static void Main(string[] args)
    {
        n = int.Parse(Console.ReadLine());
        k = int.Parse(Console.ReadLine());
        MyArray = new int[k];
        Recursion(k-1);
    }
    static void Recursion(int CurrentLoop)
    {
        if (CurrentLoop < 0)
        {
            PrintArray(MyArray);
            return;
        }
        for (int i = 1; i <= n; i++)
        {
            if (CurrentLoop !=k-1 && MyArray[CurrentLoop + 1] <= i)
            {
                continue;
            }
            MyArray[CurrentLoop] = i;
            Recursion(CurrentLoop - 1);
        }
    }
    static void PrintArray(int[] arr)
    {
        for (int i = 0; i < arr.Length; i++)
        {
            Console.Write(arr[i] + " ");
        }
        Console.WriteLine();
    }

}
